package com.h2.gwt.util.com.google.gwt.core.client;

import java.util.Set;

import com.google.gwt.core.client.JavaScriptObject;


public class JsMap<K, V> extends JavaScriptObject {

   public static JsMap<?, ?> create() {
     return JavaScriptObject.createObject().cast();
   }

   public JsMap() {
      //nothing
   }

   public final native V get(K key) /*-{
      return this[key];
   }-*/;
   
   /**
    * Gets the length of the array.
    * 
    * @return the array length
    */
   public final native int length() /*-{
     return this.length;
   }-*/;
   
   public final native Set<K> keySet() /*-{
      var result = @java.util.HashSet::new()();
      for (var key in this) {
         result.@java.util.Set::add(Ljava/lang/Object;)(key);
      }
      return result;
   }-*/;

//   public final native V get(String key) /*-{
//     return this[key];
//   }-*/;

}
